package com.chhuang.ewcrm.utils;

import com.chhuang.ewcrm.entity.*;

/**
 * @author chhuang
 * @create 2020-11-19-7:48
 */
public class WeighTemp2Entity {
    /**
     * 临时称重记录转采购记录
     * @param weighTemp
     * @param isHandwork
     * @return
     */
    public static EBuy weighTemp2EBuy(WWeighTemp weighTemp, boolean isHandwork){
        EBuy eBuy = new EBuy();

        eBuy.setWeighmanId(weighTemp.getWeighmanId());
        eBuy.setWeighmanName(weighTemp.getWeighmanName());
        eBuy.setBuyGoodsId(weighTemp.getGoodsId());
        eBuy.setBuyGoodsName(weighTemp.getGoodsName());
        eBuy.setCustomerName(weighTemp.getCustomerName());
        eBuy.setCustomerPhone(weighTemp.getCustomerPhone());
        eBuy.setWarehouseId(weighTemp.getWarehouseId());
        eBuy.setWarehouseName(weighTemp.getWarehouseName());
        eBuy.setLicensePlate(weighTemp.getLicensePlate());
        eBuy.setGrossWeight(weighTemp.getGrossWeight());
        eBuy.setTareWeight(weighTemp.getTareWeight());
        eBuy.setImpurityWeight(weighTemp.getImpurityWeight());
        eBuy.setNetWeight(weighTemp.getNetWeight());
        eBuy.setIsHandwork(isHandwork);
        eBuy.setChargemanId(weighTemp.getChargemanId());
        eBuy.setChargemanName(weighTemp.getChargemanName());
        eBuy.setSalesmanId(weighTemp.getSalesmanId());
        eBuy.setSalesmanName(weighTemp.getSalesmanName());
        eBuy.setIsDelivery(weighTemp.getIsDelivery());
        if(!eBuy.getIsDelivery()){//不是我方自提
            eBuy.setBuyPrice(weighTemp.getPrice());
            eBuy.setDeductionMoney(weighTemp.getDeductionMoney());
            eBuy.setPaymentAmount(weighTemp.getAmount());
        }
        eBuy.setRemark1(weighTemp.getRemark());
        eBuy.setEnterTime(weighTemp.getEnterTime());
        eBuy.setOutTime(weighTemp.getOutTime());

        return eBuy;
    }

    /**
     * 临时称重记录转销售记录
     * @param weighTemp
     * @param isHandwork
     * @return
     */
    public static ESell weighTemp2ESell(WWeighTemp weighTemp, boolean isHandwork){
        ESell eSell = new ESell();

        eSell.setWeighmanId(weighTemp.getWeighmanId());
        eSell.setWeighmanName(weighTemp.getWeighmanName());
        eSell.setSellGoodsId(weighTemp.getGoodsId());
        eSell.setSellGoodsName(weighTemp.getGoodsName());
        eSell.setCustomerName(weighTemp.getCustomerName());
        eSell.setCustomerPhone(weighTemp.getCustomerPhone());
        eSell.setWarehouseId(weighTemp.getWarehouseId());
        eSell.setWarehouseName(weighTemp.getWarehouseName());
        eSell.setLicensePlate(weighTemp.getLicensePlate());
        eSell.setGrossWeight(weighTemp.getGrossWeight());
        eSell.setTareWeight(weighTemp.getTareWeight());
        eSell.setImpurityWeight(weighTemp.getImpurityWeight());
        eSell.setNetWeight(weighTemp.getNetWeight());
        eSell.setIsHandwork(isHandwork);
        eSell.setChargemanId(weighTemp.getChargemanId());
        eSell.setChargemanName(weighTemp.getChargemanName());
        eSell.setSalesmanId(weighTemp.getSalesmanId());
        eSell.setSalesmanName(weighTemp.getSalesmanName());
        eSell.setIsDelivered(!weighTemp.getIsDelivery());//是否是送到
        if(!eSell.getIsDelivered()){//不是送到,是客户自提
            eSell.setSellPrice(weighTemp.getPrice());
            eSell.setDeductionMoney(weighTemp.getDeductionMoney());
            eSell.setPaymentAmount(weighTemp.getAmount());
        }
        eSell.setRemark1(weighTemp.getRemark());
        eSell.setEnterTime(weighTemp.getEnterTime());
        eSell.setOutTime(weighTemp.getOutTime());

        return eSell;
    }

    /**
     * 临时称重记录转内部周转记录
     * @param weighTemp
     * @param isHandwork
     * @return
     */
    public static ETransfer weighTemp2ETransfer(WWeighTemp weighTemp, boolean isHandwork){
        ETransfer eTransfer = new ETransfer();

        eTransfer.setWeighmanId(weighTemp.getWeighmanId());
        eTransfer.setWeighmanName(weighTemp.getWeighmanName());
        eTransfer.setGoodsId(weighTemp.getGoodsId());
        eTransfer.setGoodsName(weighTemp.getGoodsName());
        eTransfer.setGoods1Id(weighTemp.getGoods1Id());
        eTransfer.setGoods1Name(weighTemp.getGoods1Name());
        eTransfer.setWarehouseId(weighTemp.getWarehouseId());
        eTransfer.setWarehouseName(weighTemp.getWarehouseName());
        eTransfer.setWarehouse1Id(weighTemp.getWarehouse1Id());
        eTransfer.setWarehouse1Name(weighTemp.getWarehouse1Name());
        eTransfer.setLicensePlate(weighTemp.getLicensePlate());
        eTransfer.setGrossWeight(weighTemp.getGrossWeight());
        eTransfer.setTareWeight(weighTemp.getTareWeight());
        eTransfer.setImpurityWeight(weighTemp.getImpurityWeight());
        eTransfer.setNetWeight(weighTemp.getNetWeight());
        eTransfer.setIsHandwork(isHandwork);
        eTransfer.setChargemanId(weighTemp.getChargemanId());
        eTransfer.setChargemanName(weighTemp.getChargemanName());
        eTransfer.setPrice(weighTemp.getPrice());
        eTransfer.setDeductionMoney(weighTemp.getDeductionMoney());
        eTransfer.setPaymentAmount(weighTemp.getAmount());
        eTransfer.setRemark1(weighTemp.getRemark());
        eTransfer.setEnterTime(weighTemp.getEnterTime());
        eTransfer.setOutTime(weighTemp.getOutTime());

        return eTransfer;
    }

    /**
     * 临时称重记录转其它过磅记录
     * @param weighTemp
     * @param isHandwork
     * @return
     */
    public static EOther weighTemp2EOther(WWeighTemp weighTemp, boolean isHandwork){
        EOther eOther = new EOther();

        eOther.setWeighmanId(weighTemp.getWeighmanId());
        eOther.setWeighmanName(weighTemp.getWeighmanName());
        eOther.setGoodsId(weighTemp.getGoodsId());
        eOther.setGoodsName(weighTemp.getGoodsName());
        eOther.setWarehouseId(weighTemp.getWarehouseId());
        eOther.setWarehouseName(weighTemp.getWarehouseName());
        eOther.setCustomerName(weighTemp.getCustomerName());
        eOther.setCustomerPhone(weighTemp.getCustomerPhone());
        eOther.setLicensePlate(weighTemp.getLicensePlate());
        eOther.setGrossWeight(weighTemp.getGrossWeight());
        eOther.setTareWeight(weighTemp.getTareWeight());
        eOther.setImpurityWeight(weighTemp.getImpurityWeight());
        eOther.setNetWeight(weighTemp.getNetWeight());
        eOther.setIsHandwork(isHandwork);
        eOther.setChargemanId(weighTemp.getChargemanId());
        eOther.setChargemanName(weighTemp.getChargemanName());
        eOther.setPaymentAmount(weighTemp.getAmount());
        eOther.setRemark1(weighTemp.getRemark());
        eOther.setEnterTime(weighTemp.getEnterTime());
        eOther.setOutTime(weighTemp.getOutTime());

        return eOther;
    }
}
